package squares;

import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;

import borders.Door;
import borders.Open;

import squares.Square.TemperatureType;

public class TransparentSquareTest {
	private TransparentSquare transparentSquare1;
	@Before
	public void setUp() throws IllegalArgumentException, InvalidTemperatureException, InvalidHumidityException, IllegalTemperatureTypeException
	{
		transparentSquare1 = new TransparentSquare(100,TemperatureType.CELSIUS,30,false,false, Direction.SOUTH, false);
	}
	@Test
	public void testBorderCanBeChanged() {

	assert(transparentSquare1.BorderCanBeChanged(Direction.WEST, new Open(transparentSquare1)));
	assert(transparentSquare1.BorderCanBeChanged(Direction.WEST, new Door(transparentSquare1,true)));
		
	}

	@Test
	public void testTransparentSquare() {
		try {
			new TransparentSquare(300,TemperatureType.KELVIN,60,true,true,Direction.WEST,true);
		} catch (IllegalArgumentException e) {
			fail();
		} catch (InvalidTemperatureException e) {
			fail();
		} catch (InvalidHumidityException e) {
			fail();
		} catch (IllegalTemperatureTypeException e) {
			fail();
		}
		try {
			 new TransparentSquare(3299,TemperatureType.CELSIUS,50,false,false,Direction.CEILING,true);
			fail();
		} catch (IllegalArgumentException e) {
			assert(true);
		} catch (InvalidTemperatureException e) {
			assert(true);
		} catch (InvalidHumidityException e) {
			assert(true);
		} catch (IllegalTemperatureTypeException e) {
			assert(true);
		}
	}

}
